package spring.superrun.record.mvc.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import spring.superrun.tool.newid.Encrypt;

import javax.validation.constraints.NotEmpty;

@RestController
@RequestMapping("/maintenance/tools")
public class MaintenanceToolsController {
    @GetMapping("en_aes")
    public String AesEncode(@RequestParam @NotEmpty String word) throws Exception {
        return Encrypt.encryptAES(word);
    }
    @GetMapping("de_aes")
    public String AesDecode(@RequestParam @NotEmpty String word) throws Exception {
        return Encrypt.decryptAES(word);
    }
    @GetMapping("en_base64")
    public String BaseEncode(@RequestParam @NotEmpty String word) throws Exception {
        return Encrypt.encryptBASE64(word);
    }
    @GetMapping("de_base64")
    public String BaseDecode(@RequestParam @NotEmpty String word) throws Exception {
        return Encrypt.decryptBASE64(word);
    }
}
